package com.cysyz.utils;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public class MyUtil {
	@SuppressWarnings("unchecked")
	public static <T> Class<T> getParameteredType(Object obj) {
		Type superclass = obj.getClass().getGenericSuperclass();
		Class<T> realType = null;
		if (superclass instanceof ParameterizedType) {
			realType = (Class<T>) ((ParameterizedType) superclass).getActualTypeArguments()[0];
		}
		return realType;
	}
}
